﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using roysland.net.designpatterns.MVVM;
using roysland.net.xcom.core.Helpers;

namespace roysland.net.xcom.editor.ViewModel
{
    public sealed class CraftEditorViewModel : WorkspaceViewModel
    {
        public CraftEditorViewModel()
        {
            DisplayName = "Craft Editor";
            InitializeData();
        }

        private void InitializeData()
        {
            var records = GeoscapeExeParser.GetCraftStats();
            var list = new ObservableCollection<CraftStatViewModel>();
            foreach (var record in records)
            {
                list.Add(new CraftStatViewModel(record));
            }

            Crafts = list;
        }

        #region Properties

        private ObservableCollection<CraftStatViewModel> crafts;
        public ObservableCollection<CraftStatViewModel> Crafts
        {
            get { return crafts; }
            set
            {
                if (value == crafts)
                    return;

                crafts = value;

                OnPropertyChanged("Crafts");
            }
        }
        #endregion
    }
}
